package cn.edu.zzuli.nothinglink.service.impl;

import cn.edu.zzuli.nothinglink.entity.R;
import cn.edu.zzuli.nothinglink.entity.WorkSubmitRecord;
import cn.edu.zzuli.nothinglink.mapper.WorkSubmitRecordMapper;
import cn.edu.zzuli.nothinglink.service.WorkSubmitRecordService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author suzyyy
 * @since 2021-04-08
 */
@Service
public class WorkSubmitRecordServiceImpl extends ServiceImpl<WorkSubmitRecordMapper, WorkSubmitRecord> implements WorkSubmitRecordService {

    @Override
    public R correctWorkScore(JSONObject json) {
        Integer workSubmitId = json.getInteger("workSubmitId");
        Double score = json.getDouble("score");
        boolean b = updateById(new WorkSubmitRecord().setWsId(workSubmitId).setScore(score));
        if (b) return R.success();
        return R.error();
    }
}
